Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): add scheduled send functionality #1091

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

amaninyumu1
Copy link
Member

@amaninyumu1 amaninyumu1 force-pushed the Cypht-delay-send-later-scheduled-sending branch from 7aaffb2 to 0c58a6a Compare June 16, 2024 14:58
@marclaporte
Copy link
Member

Will this work with JMAP as well?

@amaninyumu1 amaninyumu1 force-pushed the Cypht-delay-send-later-scheduled-sending branch from 0c58a6a to 0aef136 Compare June 19, 2024 08:09
@josaphatim josaphatim requested a review from kroky June 19, 2024 08:12
@amaninyumu1 amaninyumu1 marked this pull request as ready for review June 19, 2024 08:12
@kroky
Copy link
Member

kroky commented Jun 20, 2024

Yes, anything we add for IMAP, we should check JMAP support as well. Overall, it is built on top of IMAP, so it should work but please check if the new Scheduled folder is OK for JMAP.

Overall, the code is good but I have one concern - it only sends out while you are actively using Cypht and it seems to warn of unsent/scheduled messages each time you leave a page (onbeforeunload). That would be annoying for the end user. I believe this comment #576 (comment) proposes using sendAt support from jmap servers or scheduled send - if it is supported, we use it, if not, we fallback to a more annoying option. At any rate, it should be configurable.

This could be fully-supported in the Cypht-Tiki integration where there could be a Tiki command run periodically in the scheduler that checks and sends scheduled messages.

@josaphatim
Copy link
Member

@kroky I added a commit to fix issue concerning onbeforeunload event and also add the option to change schedule time or send the message immediately. Can you check please.

@josaphatim josaphatim force-pushed the Cypht-delay-send-later-scheduled-sending branch 2 times, most recently from 36599a8 to 2da4ff4 Compare June 27, 2024 13:45
@marclaporte
Copy link
Member

@amaninyumu1 If you need help with JMAP, please reach out to @Shadow243 as he set up a JMAP server for testing.

@amaninyumu1 amaninyumu1 force-pushed the Cypht-delay-send-later-scheduled-sending branch 2 times, most recently from 45374ae to bdf9d5d Compare July 29, 2024 20:29
@Baraka24 Baraka24 force-pushed the Cypht-delay-send-later-scheduled-sending branch 5 times, most recently from cf0574d to af1c185 Compare August 2, 2024 10:21
@marclaporte
Copy link
Member

@amaninyumu1 "This branch has conflicts that must be resolved"

@amaninyumu1 amaninyumu1 force-pushed the Cypht-delay-send-later-scheduled-sending branch 2 times, most recently from 141f8d9 to 16293f5 Compare September 14, 2024 06:13
@amaninyumu1 amaninyumu1 force-pushed the Cypht-delay-send-later-scheduled-sending branch from 16293f5 to 41c9b95 Compare September 26, 2024 06:16
@amaninyumu1 amaninyumu1 force-pushed the Cypht-delay-send-later-scheduled-sending branch from 41c9b95 to 3fb7802 Compare October 8, 2024 02:47
@marclaporte
Copy link
Member

@amaninyumu1 This branch has conflicts that must be resolved

@amaninyumu1 amaninyumu1 force-pushed the Cypht-delay-send-later-scheduled-sending branch from 3fb7802 to e725bcc Compare October 22, 2024 19:54
@amaninyumu1
Copy link
Member Author

Hello @marclaporte , @kroky I resolved the conflicts. please review

modules/smtp/modules.php Outdated Show resolved Hide resolved
modules/smtp/modules.php Outdated Show resolved Hide resolved
modules/smtp/modules.php Outdated Show resolved Hide resolved
modules/smtp/modules.php Outdated Show resolved Hide resolved
@kroky
Copy link
Member

kroky commented Oct 23, 2024

There are still conflicts and I believe big part of the reason is #1266 - @jacob-js , can you check if some handlers in this PR need to be updated according to the router changes you did in 1266?

lib/servers.php Outdated Show resolved Hide resolved
@amaninyumu1 amaninyumu1 force-pushed the Cypht-delay-send-later-scheduled-sending branch 2 times, most recently from 8ca8a62 to b5cd302 Compare January 30, 2025 16:12
@amaninyumu1
Copy link
Member Author

$mailbox = new Hm_Mailbox($server_id, $user_config, $session, $config); for this new way of initializing Mailbox triggers unexpected errors like:
$mailbox->connect() : Uncaught Error: Call to a member function connect() on null while the $mailbox variable and the connection are not null after inspection
$mailbox->send_message($from[0]['email'], $recipients, $msg_content, $delivery_receipt); : PHP Fatal error: Uncaught Error: Call to undefined method Hm_IMAP::send_message(). Is there a new way to send messages with Hm_Mailbox. thanks
@kroky or @mercihabam can have an opinion here.

@kroky
Copy link
Member

kroky commented Jan 31, 2025

@amaninyumu1 you cannot use send_message method on an IMAP account - what would it mean? Mailbox on top of SMTP or EWS can send out emails and send_message is OK there but not on an IMAP account. For IMAP, there is store_message which stores a message in a specific folder. Please check your calling code.

@amaninyumu1
Copy link
Member Author

@kroky the message is already stored in the scheduled folder I would like to implement the send now functionality for scheduled messages I use IMAP account

@kroky
Copy link
Member

kroky commented Jan 31, 2025

You can't send through an IMAP account. Use its corresponding SMTP or EWS account stored in a profile or use the default SMTP account. Show error if there is no configured account to send from.

@amaninyumu1
Copy link
Member Author

@kroky I think this method is better for sending a message $mailbox = Hm_SMTP_List::connect($profile['smtp_id'], false); as with IMAP account you cannot send a message directly. thanks

modules/core/site.js Outdated Show resolved Hide resolved
modules/core/site.js Outdated Show resolved Hide resolved
modules/core/site.js Outdated Show resolved Hide resolved
@amaninyumu1 amaninyumu1 force-pushed the Cypht-delay-send-later-scheduled-sending branch 2 times, most recently from 06a57a4 to 27e2cbe Compare February 2, 2025 06:48
- Event handlers attached directly to target elements to avoid multiple bindings.
- Rename parse_nexter_header to parse_delayed_header to avoid confusion.
- Replacement of “var” by “let”.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants